<div id="main_content" class="holidaywrap">
    <h3><?php echo $title; ?></h3>
    <a href="<?php echo base_url('/position/update'); ?>" class="new_regis"><?php echo $lblNewRegister; ?></a>
    <div class="table_list">
        <table border="0"  class="list_view_data salaryinfo" cellpadding="0" cellspacing="0">
            <tr align="center">
                <th><?php echo $lblOrder; ?></th>
                <th><?php echo $lblPositionName; ?></th>
                <th><?php echo $lblPositionAction; ?></th>
                <th><?php echo $lblPositionActive; ?></th>
            </tr>
            <?php if ($data): ?>
                <?php foreach ($data as $item): ?>
                    <tr>
                        <td align="center" width="50"><?php echo ++$order; ?></td>
                        <td align="center" width="350" title="<?php echo dQuotes($item->PositionName); ?>"><div class="table_col"><?php echo subString(dQuotes($item->PositionName), 40); ?></div></td>
                        <td align="center" width="70">
                            <div class="table_col">
                                <a href="<?php echo base_url('/position/update/'); ?>" data-positionID="<?php echo $item->PositionId; ?>">
                                    <img src="<?php echo base_url('/public/sites/images/Pencil.png'); ?>" width="15">
                                </a>
                            </div>
                        </td>
                        <td align="center" width="70">
                            <img src="<?php echo ($item->Del_Flag) ? base_url('/public/sites/images/uncheck.gif') : base_url('/public/sites/images/check-icon.png'); ?>" width="15">
                        </td>
                    </tr> 
                <?php endforeach; ?>
            <?php endif; ?>
        </table>
        <?php if (!$data): ?>
            <div class="clr"></div>
            <div class="errormessage"><?php echo $message; ?></div>
        <?php endif ?>
    </div>
    <div class="clr"></div>
    <div class="pagination"><?php echo $pagi; ?></div>
</div>
<div class="redirectTo">
    <form class="frmRedirectTo" class="frmRedirectTo" name="frmRedirectTo" action="" method="POST">
        <input type="hidden" name="txtPositionID" class="txtPositionID" value="0">
    </form>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        /*change link action to post action*/
        $('.table_col a').click(function(e) {
            e.preventDefault();
            var url = $(this).attr('href');
            var positionID = $(this).attr('data-positionID');
            $('.frmRedirectTo').attr('action', url);
            $('.txtPositionID').val(positionID);
            $('.frmRedirectTo').submit();
        });
    });
</script>